$(function(){
	 //begin validate	   
	setupFormValidation("#regFrm",{
		rules: {
			inputEmail: {
				required: true,
				email:true,
				remote:{ //Check the user exit or not
                    type:"POST",
                    url:"checkEmail",
                    data:{
                    	inputEmail:function(){return $("#inputEmail").val();}
                         }
                  } 
			},
			inputPassword:{
				required:true,
				minlength: 8
			},
			inputPhone: {
				required: true,
				ChineseCellphone:true
			}
		},
		messages: {
			inputEmail: {
				required: "电子邮箱为必填！",
				email:'电子邮件格式不正确！',
				remote:"用户名已经被注册"
			},
			inputPassword:{
				required:'密码为必填！',
				minlength: '密码最小为8位！'
			},
			inputPhone: {
				required: '手机号码为必填',
				ChineseCellphone:'手机号码格式不正确！'
			}
			}
		});
	// end validate
	
	initAjaxForm({
		form: $("#regFrm"),
		beforeSubmit: function(){
			return $(this).valid();
		},
		success: function(response){
			console.log("success");
		}
	});
})
